There is an undocumented way to get the user's IceLib session from a .net client Add-In. In order to be able to use the Session, you must have the IceLib license I3_FEATURE_ICELIB_SDK. Inside your Add-In, you have access to the IServiceProvider and as long as you have the IceLib license, you can get the session out of the service provider.
There is one gotcha here, and you want to make sure that in your visual studio project that you are NOT copying the IceLib dlls to the Addins folder. Doing so will cause a duplicate, and possibly different version of the dlls from what the client uses and can cause the .GetService method call to return null.
In this sample application, we are also using the INotificationService. We attempt to get the Session and then will pop a notification if we were successful or not.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
using System;
using ININ.InteractionClient.AddIn;
using ININ.IceLib.Connection;
namespace AddIn_SessionTest
{
public class Class1 : IAddIn
{
Session m_Session = null;
ITraceContext m_TraceContext = null;
INotificationService m_Notification = null;
public void Load(IServiceProvider serviceProvider)
{
m_TraceContext = (ITraceContext)serviceProvider.GetService(typeof(ITraceContext));
m_TraceContext.Status("AddIn \"AddIn_SessionTest\":\nGetting Notification service.");
m_Notification = (INotificationService)serviceProvider.GetService(typeof(INotificationService));
try
{
m_TraceContext.Status("AddIn \"AddIn_SessionTest\":\nGetting Session...");
m_Session = (Session)serviceProvider.GetService(typeof(Session));
if (m_Session != null)
{
m_TraceContext.Status("AddIn \"AddIn_SessionTest\":\nGetting Session: OK");
}
else
{
m_TraceContext.Warning("AddIn \"AddIn_SessionTest\":\nGetting Session: Failed");
}
}
catch (Exception exc)
{
m_TraceContext.Error("AddIn \"AddIn_SessionTest\":\nException: getting Session: Failed\nMessage: " + exc.Message);
}
}
public void Unload()
{
}
}
}
Code posted by Robert.Herms@bertelsmann.de on the old Interactive Intelligence forum http://community.inin.com/forums/showthread.php?9174-IAddIn-How-to-get-the-user-status
-Kevin